package com.pw.ba.base.controller;

import com.pw.ba.base.pojo.CateGory;
import com.pw.ba.base.pojo.TopTab;
import com.pw.ba.base.service.IndexService;
import com.pw.ba.result.ApiResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/home")
public class IndexController {

    @Autowired
    IndexService indexService;

    @GetMapping("/toptablist")
    public List TopTabsList(){
        List<TopTab> topTabs = indexService.selectTab();
        System.out.println(topTabs);
        return topTabs;
    }

    @GetMapping("/categorylist")
    public ApiResult Category(){
        List<CateGory> cateGoryLists = indexService.cateList();
        String s = cateGoryLists.toString();
        System.out.println(s);
        return ApiResult.OKResult(cateGoryLists);
    }



}
